<%@page import="ch.ethz.inf.shop.model.Product"%>
<%@page import="ch.ethz.inf.shop.ProductServlet"%>
<%@page import="ch.ethz.inf.shop.UserServlet"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="MasterHeader.jsp"%>

<h1>Product Detail</h1>

<%=session.getAttribute("productTable")%>
<hr />
<h2>Comments</h2>
<%=session.getAttribute("commentTable")%>
<hr />
<%
	if (session.getAttribute(UserServlet.SESSION_USER_LOGGED_IN) != null && (Boolean) session.getAttribute(UserServlet.SESSION_USER_LOGGED_IN)) {
		// User is logged in. Display the details:
%>
<h2>Add your comment</h2>
<form method="post" action="Product">
	<div>
		<input type="hidden" name="productId"
			value="<%=((Product)session.getAttribute(ProductServlet.CURRENT_PRODUCT)).getProductId()%>">
		<textarea name="comment" cols="50" rows="10"></textarea>
		<input type="submit" value="Post" title="post comment" />
	</div>
</form>
<%
	}
%>

<%@ include file="MasterFooter.jsp"%>